<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../base_top.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>关注的商店</title>
    
    <%@ include file="../base_head.jsp" %>
    
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/user/common.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/user/style.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/user/shop_style.css">
    <link rel="stylesheet" href="<%=basePath%>css/goods/kkpager_blue.css">
    <script type="text/javascript" src="<%=basePath%>js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/user/zs.order.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    	//全选
    	$(".all_checked").click(function() {
    		var check = $(this).is(':checked');
    		$(".all_checked").each(function() {
    			$(this).prop("checked",check);
    		});
    		if(check) {
    			$(".shop_single_check_sub").each(function() {
    				$(this).prop("checked",true);
    			});
    		} else {
    			$(".shop_single_check_sub").each(function() {
    				$(this).prop("checked",false);
    			});
    		}
    	});
    	
    	//单个取消关注
    	$(".cancel_one").click(function() {
    		var parent = $(this).parent().parent();
    		var id = $(this).parent().find("input[name=csId]").val();
    		$.ajax({
				cache: false,
				url: "collect/collectStoreCancel",
				type: "GET",
				data: {ids:id},
				dataType:"json",
			    success: function(data) {
			    	if (data == "success") {
			    		parent.remove();
			    	}
			    }
			});
    	});
    	//批量取消关注
    	$(".cancel_attention").click(function() {
    		var conf = confirm('确定取消关注吗？');
    		if (existsChecked() && conf) {
    			var checkArray = new Array();
    			var url = "collect/collectStoreCancel?";
    			var i = 0;
    			$(".shop_single_check_sub").each(function() {
    				if ($(this).is(':checked')) {
    					checkArray.push($(this));
    					if (i == 0) {
	    					url += "ids=" + $(this).val();
	    					i++;
    					} else {
    						url += "&ids=" + $(this).val();
    					}
    				}
    			});
    			
    			$.ajax({
    				cache: false,
    				url: url,
    				type: "GET",
    				data: new Date().getTime(),
    				dataType:"json",
    			    success: function(data) {
    			    	if (data == "success") {
    			    		for (var i = 0; i<checkArray.length; i++) {
    			    			checkArray[i].parent().parent().remove();
    			    		}
    			    	}
    			    }
    			});
    		}
    	});
    	
    	function existsChecked() {
        	var exists = false;
    		$(".shop_single_check_sub").each(function() {
    			if($(this).is(':checked')) {
    				exists = true;
    			}
    		});
    		return exists;
    	}
    	
    	var totalPage = $("input[name='totalPage']").val();
        var totalRecords = $("input[name='totalRecords']").val();
        var pageNo = $("input[name='pageNo']").val();
        if (!pageNo) {pageNo = 1;}
        paper(totalPage, totalRecords, pageNo, "collect/collectStoreList", "");
    });
    </script>

  </head>
  
  <body>
<!--topbar开始-->
<%@ include file="../page_topbar.html" %>
<!--topbar结束-->
<div id="wrap">
    <!--search开始-->
    <%@ include file="../selfCenter_search.html" %>
    <!--search结束-->
    
    <!--左边订单中心开始-->
    <%@ include file="../selfCenter_menu.html" %>
    <!--左边订单中心结束-->
    
    <!--右边关注店铺开始-->
    <div class="common_guanzhu">
    	<div class="common_guanzhu_title_sub"><a href="collect/collectGoodsList">关注的商品</a></div>
        <div class="common_guanzhu_title">关注的店铺
            <div style="width: 80px;  border: 1px solid #A60000;"></div>
        </div>
        <div class="common_guanzhu_title_sub"><a href="JavaScript:void(0);">关注的活动</a></div>
    </div>
    <!--右边关注店铺结束-->
    <!--商品详情开始-->
    <div class="shop_detail">
        <div class="shop_detail_title">
            <input type="checkbox" class="all_checked">
            全选
            <a href="JavaScript:void(0);" class="cancel_attention">取消关注</a>
        </div>
        <div class="shop_detail_page"><%-- 1/1 <input type="button" value="<">&nbsp;&nbsp;<input type="button" value="下一页"> --%></div>
        <hr style="width: 98%; margin-left: 1%; color: #ccc;">
        <div class="shop_detail_shop">
        	<s:iterator value="#request.collectList" id="store">
        	<div class="shop_single">
                <div class="shop_single_check"><input class="shop_single_check_sub" type="checkbox" value='<s:property value="#request.store.csId"/>'></div>
                <div class="shop_single_shop"><img src='<s:property value="#request.store.shopkeeperInfo.skPortrait"/>'><s:property value="#request.store.shopkeeperInfo.skName"/></div>
                <hr style="width: 80%; margin-left: 10%; color: #ccc;">
                <div class="person">关注人气：<s:property value="#request.store.attentionNum"/>人</div>
                <div class="time">关注时间：<s:property value="#request.store.createTime.toString().substring(0,10)"/></div>
                <div class="btn">
                	<input type="hidden" value='<s:property value="#request.store.csId"/>' name="csId"/>
	                <input type="button" value="进入店铺">
	                <input type="button" value="取消关注" class="cancel_one">
                </div>
            </div>
        	</s:iterator>
        </div>
        <div class="shop_detail_title">
            <input type="checkbox" class="all_checked">
            全选
            <a href="JavaScript:void(0);" class="cancel_attention">取消关注</a>
        </div>
        <div class="shop_place">
        <input type="hidden" name="pageNo" value="${pageNo}"/>
    	<input type="hidden" name="totalPage" value="${totalPage}"/>
    	<input type="hidden" name="totalRecords" value="${totalRecords}"/>
        <div id="kkpager"></div>
        </div>
    </div>
    <!--商品详情结束-->
    <!--右边推荐店铺开始-->
    <s:set value="#request.recStoreMap" id="recStore"/>
    <div class="shop_tuijian">
        <div class="shop_tuijian_title">为你推荐</div>
        <div class="shop_tuijian_shop">
            <div class="single_div">
                <a href="JavaScript:void(0);">
                    <div class="logo"><img src='<s:property value="#request.recStore['0020501'].skPortrait"/>'></div>
                    <div class="name"><s:property value="#request.recStore['0020501'].skName"/></div>
                </a>
            </div>
            <div class="single_div">
                <a href="JavaScript:void(0);">
                    <div class="logo"><img src='<s:property value="#request.recStore['0020502'].skPortrait"/>'></div>
                    <div class="name"><s:property value="#request.recStore['0020502'].skName"/></div>
                </a>
            </div>
            <div class="single_div">
                <a href="JavaScript:void(0);">
                    <div class="logo"><img src='<s:property value="#request.recStore['0020503'].skPortrait"/>'></div>
                    <div class="name"><s:property value="#request.recStore['0020503'].skName"/></div>
                </a>
            </div>
            <div class="single_div">
                <a href="JavaScript:void(0);">
                    <div class="logo"><img src='<s:property value="#request.recStore['0020504'].skPortrait"/>'></div>
                    <div class="name"><s:property value="#request.recStore['0020504'].skName"/></div>
                </a>
            </div>
            <div class="single_div">
                <a href="JavaScript:void(0);">
                    <div class="logo"><img src='<s:property value="#request.recStore['0020505'].skPortrait"/>'></div>
                    <div class="name"><s:property value="#request.recStore['0020505'].skName"/></div>
                </a>
            </div>
            <div class="single_div">
                <a href="JavaScript:void(0);">
                    <div class="logo"><img src='<s:property value="#request.recStore['0020506'].skPortrait"/>'></div>
                    <div class="name"><s:property value="#request.recStore['0020506'].skName"/></div>
                </a>
            </div>
        </div>
    </div>
    <!--右边推荐店铺结束-->
    <!--广告-->
    <%@ include file="../selfCenter_bottom_four-ad.html" %>
    <!--广告结束-->

</div>
</body>
</html>
